CentOS7与Windows共享文件夹 – 蓝队云

您所在的位置:网站首页 centos7 文件共享 CentOS7与Windows共享文件夹 – 蓝队云

CentOS7与Windows共享文件夹 – 蓝队云

2023-06-14 14:21| 来源: 网络整理| 查看: 265

CentOS7与Windows共享文件夹 2023-05-30 14:57:41 567

一、CentOS7安装samba,用于在Linux系统上实现SMB协议的软件

在终端运行命令

yum install samba

 

二、创建准备分享的文件夹

在根目录下建立/gongxiang(自定义)子目录,创建文件test.txt,并修改其权限为可读可写(777)

1.创建共享的文件夹gongxiang

[root@hadoop100 /]# mkdir /gongxiang

2.创建文件test.txt

[root@hadoop100 gongxiang]# Touch test.txt

3.修改目录权限

[root@hadoop100  /]# chmod -R 777 gongxiang

 

三、修改samba配置文件

CentOS7中,samba配置文件在/etc/samba/smb.conf

1. 进入配置文件,修改配置文件

[root@hadoop100 samba]# Vi /etc/samba/smb.conf

2. 添加如下配置

[gongxiang]

           comment = my share files

           path = /gongxiang

           writable = yes

           public = yes

image.png

3.检查配置文件是否正确

[root@hadoop100 samba]# testparm

image.png

四、添加系统用户及samba用户

1.添加系统用户

[root@hadoop100 samba]# useradd xr

2.查看系统用户是否添加成功

[root@hadoop100 samba]#  cat /etc/passwd

image.png

3.添加samba用户

[root@hadoop100 samba]# smbpasswd -a  xr

image.png

五、关闭SELinux服务以及防火墙

1.关闭防火墙

[root@hadoop100 samba]# systemctl stop firewalld

2.关闭SELinux服务

[root@hadoop100 samba]#Setenforce 0

 

六、重新启动smb和nmb服务

[root@hadoop100 samba]# systemctl restart smb

[root@hadoop100 samba]# systemctl restart nmb

 

七、linux下查看该共享文件

[root@hadoop100 samba]# smbclient //192.168.10.100/gongxiang -u xr

image.png

八、Windows下查看该共享文件

ctrl+r打开运行框,输入IP地址便可以看到共享的文件夹gognxiang以及该文件夹内部的文件、文件夹。

image.png

会员登录 账号或邮箱登录

还没有账号?立即 免费注册

其他账户快捷登录: 忘记密码? 上一篇:linux磁盘分区和挂载下一篇:Linux流量监控工具 - iftop


【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3